import Vue from 'vue'
import VueRouter from 'vue-router'

import tables from'./department.js'
import personal from './personal.js'

Vue.use(VueRouter)

const routes = [
  {
    path:'/',
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import(/* webpackChunkName: "login" */ '../views/login.vue')
  },
  {
    path:'/home',
    component: () => import(/* webpackChunkName: "index" */ '../views/index.vue'),
    children:[
      {
        path:'',
        component: () => import(/* webpackChunkName: "home" */ '../views/home.vue'),
        meta:['首页']
      }
    ]
  },
  {
    path:'/personal',
    redirect: 'personal/mine',
    component: () => import(/* webpackChunkName: "index" */ '../views/index.vue'),
    children:personal
  },
  {
    path:'/tables',
    redirect: 'tables/department',
    component: () => import(/* webpackChunkName: "index" */ '../views/index.vue'),
    children:tables
  },
  {
    path:'*',
    redirect: 'home'
  }
]

const router = new VueRouter({
  linkActiveClass:'active',
  routes
})

export default router
